#pragma once

#include "Game/Process/RenderProcess.h"
#include "Render/Texture/Picture2DTexture.h"
#include "Render/Texture/RenderTarget.h"
#include "Render/Tradition/RHIRenderPass.h"
#include "Render/Tradition/GraphicsPipeline.h"
#include "Render/Texture/ColorRenderTarget.h"
#include "Render/Texture/CubemapTexture.h"
#include "Render/Texture/DepthRenderTarget.h"
#include "Render/Shader/RHIDescriptor.h"
#include "Render/Tradition/RHIFramebuffer.h"
#include "LocalEntity.h"
#include "Render/Tradition/RHIFence.h"

class LocalScene;

class MrtProcess : public RenderProcess
{
	DECLARE_PROCESS(MrtProcess)

	struct LocalVertex
	{
		glm::vec3 position;
		glm::vec3 normal;
		glm::vec2 uv;
	};

	struct Ubo
	{
		glm::mat4 proj;
		glm::mat4 view;
	};

	struct PushConstants
	{
		glm::mat4 model;
		glm::vec3 albedo;
		uint32 hasTexture;
	};

protected:

	virtual void OnInit() override;

	virtual void OnTick(float deltaTime) override;

	virtual void OnResize() override;

protected:

	LocalScene* mLocalScene;

	LocalEntity* mSceneEntity;

	int32 mObjectSize;

	std::vector<PushConstants> mPushConstants;



	RefCountPtr<RHITexture> mEmptyImage;

	RefCountPtr<RHISampler> mEmptySampler;

	RefCountPtr<RHIBuffer> mUboBuffer;



	RefCountPtr<ColorRenderTarget> mPositionRenderTarget;

	RefCountPtr<ColorRenderTarget> mNormalRenderTarget;

	RefCountPtr<ColorRenderTarget> mAlbedoRenderTarget;

	RefCountPtr<DepthRenderTarget> mDepthRenderTarget;


	RefCountPtr<RHIDescriptor> mDescriptor;

	RefCountPtr<GraphicsPipeline> mPipeline;

	RefCountPtr<RHIRenderPass> mRenderPass;

	RefCountPtr<RHIFrameBuffer> mFrameBuffer;

	RefCountPtr<RHICommandBuffer> mCommandBuffer;

};
